package com.java.io;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

public class RandomAccessFileTest {
	public static void main(String[] args) {
		RandomAccessFile raf=null;
		int code =Integer.parseInt(args[1]);
		try {
			int a;
			raf=new RandomAccessFile(args[0],"rw");
			while((a=raf.read())!=-1){
				raf.seek(raf.getFilePointer()-1);
				raf.write(a^code);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e){
			e.printStackTrace();
		} finally{
		}
	}
}
